#include<stdio.h>
#include<math.h>
int main()
{
	double Pi = 0;
	double term = 1.0;
	int sign = 1;
	double n = 1;
	while (fabs(term) >= 1E-6)
	{
		Pi = Pi + term;
		n = n + 2;
		sign = -sign;
		term = sign / n;
	}
	Pi = 4 * Pi;
	printf("Pi = %f", Pi);
	return 0;
}